package org.teremail.mailbox;

/**
 * A entry for a particular message in a folder.
 * 
 * @author Michael Barker
 *
 */
public class EntryDO {

    private final int uid;
    private final String messageId;

    public EntryDO(int uid, String messageId) {
        this.uid = uid;
        this.messageId = messageId;
    }

    /**
     * @return the uid
     */
    public int getUid() {
        return uid;
    }

    /**
     * @return the messageId
     */
    public String getMessageId() {
        return messageId;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((messageId == null) ? 0 : messageId.hashCode());
        result = prime * result + uid;
        return result;
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final EntryDO other = (EntryDO) obj;
        if (messageId == null) {
            if (other.messageId != null)
                return false;
        } else if (!messageId.equals(other.messageId))
            return false;
        if (uid != other.uid)
            return false;
        return true;
    }

    
}
